package com.jboa.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.jboa.dao.IDetailDAO;
@Repository("detailDao")
public class DetailDAOImpl extends HibernateDaoSupport implements IDetailDAO {

	/**
	 * 根据报销单号删除信息
	 */
	public Integer deleteByVoucherId(final Long id) {
		return (Integer)getHibernateTemplate().execute(new HibernateCallback() {

			public Object doInHibernate(Session session)
					throws HibernateException, SQLException {
				Query query=session.createQuery("delete BizClaimVoucherDetail b where b.bizClaimVoucher.id=:id");
				query.setLong("id", id);
				Object o= query.executeUpdate();
				return o;
			}
			
		});
	}

}
